vc-extras 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/README.md +128 -71
  2. package/agent-install.mjs +159 -0
  3. package/agents/tester.md +23 -23
  4. package/install-extras.mjs +41 -109
  5. package/install-menu.mjs +22 -43
  6. package/install-skills.mjs +112 -112
  7. package/package.json +72 -28
  8. package/plugin-registry.mjs +73 -0
  9. package/plugins/config-ui/index.ts +159 -159
  10. package/plugins/config-ui/lib/arguments.mjs +24 -24
  11. package/plugins/config-ui/lib/documents.mjs +67 -67
  12. package/plugins/config-ui/lib/frontmatter.mjs +91 -91
  13. package/plugins/config-ui/lib/open.mjs +16 -16
  14. package/plugins/config-ui/lib/ownership.mjs +99 -99
  15. package/plugins/config-ui/lib/page.mjs +11 -11
  16. package/plugins/config-ui/lib/patch.mjs +35 -35
  17. package/plugins/config-ui/lib/paths.mjs +14 -14
  18. package/plugins/config-ui/lib/plugin-fields.mjs +86 -86
  19. package/plugins/config-ui/lib/plugin-validation.mjs +28 -28
  20. package/plugins/config-ui/lib/redaction.mjs +8 -8
  21. package/plugins/config-ui/lib/registry.mjs +282 -282
  22. package/plugins/config-ui/lib/secrets.mjs +44 -44
  23. package/plugins/config-ui/lib/server.mjs +250 -250
  24. package/plugins/config-ui/lib/sources.mjs +96 -96
  25. package/plugins/config-ui/lib/state.mjs +156 -156
  26. package/plugins/config-ui/lib/themes.mjs +113 -113
  27. package/plugins/config-ui/lib/writer.mjs +690 -690
  28. package/plugins/config-ui/project-local-owner.ts +106 -106
  29. package/plugins/config-ui/vc-extras.plugin.json +13 -0
  30. package/plugins/config-ui/web/app.mjs +997 -997
  31. package/plugins/config-ui/web/index.html +342 -342
  32. package/plugins/pi-blackhole/vc-extras.plugin.json +12 -0
  33. package/plugins/pi-btw/vc-extras.plugin.json +12 -0
  34. package/plugins/pi-claude-code/vc-extras.plugin.json +12 -0
  35. package/plugins/pi-fff/vc-extras.plugin.json +12 -0
  36. package/plugins/pi-jev-auto-mode/vc-extras.plugin.json +12 -0
  37. package/plugins/pi-mcp-adapter/vc-extras.plugin.json +12 -0
  38. package/plugins/pi-web-access/vc-extras.plugin.json +12 -0
  39. package/plugins/vc-ask/claude-hook.mjs +37 -0
  40. package/plugins/vc-ask/codex-native.mjs +28 -0
  41. package/plugins/vc-ask/host-channel.mjs +75 -0
  42. package/plugins/vc-ask/index.ts +57 -0
  43. package/plugins/vc-ask/native-questions.mjs +33 -0
  44. package/plugins/vc-ask/package.json +10 -0
  45. package/plugins/vc-ask/payload.ts +170 -0
  46. package/plugins/vc-ask/questionnaire/LICENSE.ask-user-question +21 -0
  47. package/plugins/vc-ask/questionnaire/UPSTREAM.md +104 -0
  48. package/plugins/vc-ask/questionnaire/answer-channel.ts +135 -0
  49. package/plugins/vc-ask/questionnaire/config.ts +180 -0
  50. package/plugins/vc-ask/questionnaire/events.ts +154 -0
  51. package/plugins/vc-ask/questionnaire/execute.ts +688 -0
  52. package/plugins/vc-ask/questionnaire/i18n.ts +73 -0
  53. package/plugins/vc-ask/questionnaire/inline-entry.ts +312 -0
  54. package/plugins/vc-ask/questionnaire/locales/de.json +43 -0
  55. package/plugins/vc-ask/questionnaire/locales/en.json +42 -0
  56. package/plugins/vc-ask/questionnaire/locales/es.json +43 -0
  57. package/plugins/vc-ask/questionnaire/locales/fr.json +43 -0
  58. package/plugins/vc-ask/questionnaire/locales/pt-BR.json +43 -0
  59. package/plugins/vc-ask/questionnaire/locales/pt.json +43 -0
  60. package/plugins/vc-ask/questionnaire/locales/ru.json +43 -0
  61. package/plugins/vc-ask/questionnaire/locales/uk.json +43 -0
  62. package/plugins/vc-ask/questionnaire/locales/zh.json +46 -0
  63. package/plugins/vc-ask/questionnaire/presentation.ts +11 -0
  64. package/plugins/vc-ask/questionnaire/question-preview.ts +6 -0
  65. package/plugins/vc-ask/questionnaire/rpc.ts +221 -0
  66. package/plugins/vc-ask/questionnaire/session-timeout.ts +67 -0
  67. package/plugins/vc-ask/questionnaire/state/build-questionnaire.ts +144 -0
  68. package/plugins/vc-ask/questionnaire/state/external-editor.ts +62 -0
  69. package/plugins/vc-ask/questionnaire/state/geometry.ts +131 -0
  70. package/plugins/vc-ask/questionnaire/state/key-router.ts +382 -0
  71. package/plugins/vc-ask/questionnaire/state/panel-router.ts +32 -0
  72. package/plugins/vc-ask/questionnaire/state/questionnaire-session.ts +642 -0
  73. package/plugins/vc-ask/questionnaire/state/row-intent.ts +143 -0
  74. package/plugins/vc-ask/questionnaire/state/selectors/contract.ts +24 -0
  75. package/plugins/vc-ask/questionnaire/state/selectors/derivations.ts +40 -0
  76. package/plugins/vc-ask/questionnaire/state/selectors/focus.ts +17 -0
  77. package/plugins/vc-ask/questionnaire/state/selectors/projections.ts +99 -0
  78. package/plugins/vc-ask/questionnaire/state/state-reducer.ts +455 -0
  79. package/plugins/vc-ask/questionnaire/state/state.ts +90 -0
  80. package/plugins/vc-ask/questionnaire/state/vertical.ts +158 -0
  81. package/plugins/vc-ask/questionnaire/timeout.ts +59 -0
  82. package/plugins/vc-ask/questionnaire/tool/external-answer.ts +103 -0
  83. package/plugins/vc-ask/questionnaire/tool/format-answer.ts +24 -0
  84. package/plugins/vc-ask/questionnaire/tool/normalize-params.ts +37 -0
  85. package/plugins/vc-ask/questionnaire/tool/response-envelope.ts +75 -0
  86. package/plugins/vc-ask/questionnaire/tool/types.ts +74 -0
  87. package/plugins/vc-ask/questionnaire/tool/validate-questionnaire.ts +75 -0
  88. package/plugins/vc-ask/questionnaire/view/card-theme.ts +245 -0
  89. package/plugins/vc-ask/questionnaire/view/components/inline-input.ts +66 -0
  90. package/plugins/vc-ask/questionnaire/view/components/multi-select-view.ts +177 -0
  91. package/plugins/vc-ask/questionnaire/view/components/option-list-view.ts +65 -0
  92. package/plugins/vc-ask/questionnaire/view/components/preview/markdown-content-cache.ts +101 -0
  93. package/plugins/vc-ask/questionnaire/view/components/preview/preview-block-renderer.ts +130 -0
  94. package/plugins/vc-ask/questionnaire/view/components/preview/preview-box-renderer.ts +86 -0
  95. package/plugins/vc-ask/questionnaire/view/components/preview/preview-layout-decider.ts +204 -0
  96. package/plugins/vc-ask/questionnaire/view/components/preview/preview-pane.ts +257 -0
  97. package/plugins/vc-ask/questionnaire/view/components/submit-picker.ts +65 -0
  98. package/plugins/vc-ask/questionnaire/view/components/tab-bar.ts +57 -0
  99. package/plugins/vc-ask/questionnaire/view/components/wrapping-select.ts +269 -0
  100. package/plugins/vc-ask/questionnaire/view/dialog-builder.ts +319 -0
  101. package/plugins/vc-ask/questionnaire/view/document-theme.ts +53 -0
  102. package/plugins/vc-ask/questionnaire/view/document-view.ts +306 -0
  103. package/plugins/vc-ask/questionnaire/view/panel-chrome.ts +133 -0
  104. package/plugins/vc-ask/questionnaire/view/props-adapter.ts +77 -0
  105. package/plugins/vc-ask/questionnaire/view/stateful-view.ts +24 -0
  106. package/plugins/vc-ask/questionnaire/view/tab-components.ts +16 -0
  107. package/plugins/vc-ask/questionnaire/view/tab-content-strategy.ts +280 -0
  108. package/plugins/vc-ask/questionnaire/view/vertical-view.ts +218 -0
  109. package/plugins/vc-ask/user-input-events.ts +34 -0
  110. package/plugins/vc-ask/vc-extras.plugin.json +18 -0
  111. package/plugins/vc-footer/agents/claude-code/adapter.mjs +29 -0
  112. package/plugins/vc-footer/agents/claude-code/cli.mjs +23 -0
  113. package/plugins/vc-footer/agents/claude-code/renderer.mjs +1 -0
  114. package/plugins/vc-footer/agents/claude-code/types.d.ts +38 -0
  115. package/plugins/vc-footer/agents/codex/adapter.mjs +13 -0
  116. package/plugins/vc-footer/agents/codex/mcp.mjs +45 -0
  117. package/plugins/vc-footer/agents/codex/native.mjs +19 -0
  118. package/plugins/vc-footer/agents/codex/renderer.mjs +2 -0
  119. package/plugins/vc-footer/agents/pi/adapter.mjs +23 -0
  120. package/plugins/vc-footer/agents/pi/index.js +84 -0
  121. package/plugins/vc-footer/agents/pi/project-local-owner.mjs +97 -0
  122. package/plugins/vc-footer/agents/pi/renderer.mjs +5 -0
  123. package/plugins/vc-footer/core/data.mjs +218 -0
  124. package/plugins/vc-footer/core/render.mjs +291 -0
  125. package/plugins/vc-footer/core/types.d.ts +29 -0
  126. package/plugins/vc-footer/package.json +22 -0
  127. package/plugins/vc-footer/vc-extras.plugin.json +32 -0
  128. package/skills/animate/LICENSE +21 -21
  129. package/skills/animate/RECIPES.md +324 -324
  130. package/skills/animate/SKILL.md +208 -208
  131. package/skills/animate/UPSTREAM.md +19 -19
  132. package/skills/animation-performance/LICENSE +21 -21
  133. package/skills/animation-performance/SKILL.md +223 -223
  134. package/skills/animation-performance/UPSTREAM.md +19 -19
  135. package/skills/answer-me-with-html/SKILL.md +174 -174
  136. package/skills/answer-me-with-html/scripts/am.mjs +12896 -12896
  137. package/skills/apple-design/LICENSE +21 -21
  138. package/skills/apple-design/SKILL.md +291 -291
  139. package/skills/apple-design/UPSTREAM.md +19 -19
  140. package/skills/bad-smell/SKILL.md +44 -44
  141. package/skills/commit/SKILL.md +90 -90
  142. package/skills/emil-design-eng/LICENSE +21 -21
  143. package/skills/emil-design-eng/SKILL.md +677 -677
  144. package/skills/emil-design-eng/UPSTREAM.md +19 -19
  145. package/skills/find-the-truth/SKILL.md +38 -38
  146. package/skills/find-the-truth/references/trace-method.md +48 -48
  147. package/skills/find-the-truth/references/truth-method.md +39 -39
  148. package/skills/gestures/LICENSE +21 -21
  149. package/skills/gestures/SKILL.md +107 -107
  150. package/skills/gestures/UPSTREAM.md +19 -19
  151. package/skills/humanizer-zh/LICENSE +21 -21
  152. package/skills/humanizer-zh/SKILL.md +409 -409
  153. package/skills/humanizer-zh/UPSTREAM.md +7 -7
  154. package/skills/impeccable/LICENSE +191 -191
  155. package/skills/impeccable/NOTICE.md +11 -11
  156. package/skills/impeccable/SKILL.md +89 -89
  157. package/skills/impeccable/licenses/modern-screenshot-MIT.txt +8 -8
  158. package/skills/impeccable/licenses/platform-design-skills-MIT.txt +21 -21
  159. package/skills/impeccable/reference/adapt.md +318 -318
  160. package/skills/impeccable/reference/adapt.native.md +58 -58
  161. package/skills/impeccable/reference/android.md +46 -46
  162. package/skills/impeccable/reference/animate.md +89 -89
  163. package/skills/impeccable/reference/audit.md +139 -139
  164. package/skills/impeccable/reference/audit.native.md +139 -139
  165. package/skills/impeccable/reference/bolder.md +33 -33
  166. package/skills/impeccable/reference/clarify.md +94 -94
  167. package/skills/impeccable/reference/colorize.md +86 -86
  168. package/skills/impeccable/reference/component-review.md +63 -63
  169. package/skills/impeccable/reference/craft-floor.md +44 -44
  170. package/skills/impeccable/reference/craft.md +5 -5
  171. package/skills/impeccable/reference/critique.md +819 -819
  172. package/skills/impeccable/reference/degraded/asset-producer.md +41 -41
  173. package/skills/impeccable/reference/degraded/documenter.md +23 -23
  174. package/skills/impeccable/reference/degraded/finish-reviewer.md +37 -37
  175. package/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -92
  176. package/skills/impeccable/reference/delight.md +70 -70
  177. package/skills/impeccable/reference/distill.md +111 -111
  178. package/skills/impeccable/reference/doctor.md +54 -54
  179. package/skills/impeccable/reference/document.md +416 -416
  180. package/skills/impeccable/reference/extract.md +69 -69
  181. package/skills/impeccable/reference/generate.md +101 -101
  182. package/skills/impeccable/reference/harden.md +362 -362
  183. package/skills/impeccable/reference/hooks.md +114 -114
  184. package/skills/impeccable/reference/init.md +131 -131
  185. package/skills/impeccable/reference/ios.md +51 -51
  186. package/skills/impeccable/reference/layout.md +84 -84
  187. package/skills/impeccable/reference/live-setup.md +104 -104
  188. package/skills/impeccable/reference/live.md +327 -327
  189. package/skills/impeccable/reference/mode-operate.md +21 -21
  190. package/skills/impeccable/reference/mode-persuade.md +19 -19
  191. package/skills/impeccable/reference/mode-read.md +21 -21
  192. package/skills/impeccable/reference/new-work.md +152 -152
  193. package/skills/impeccable/reference/onboard.md +234 -234
  194. package/skills/impeccable/reference/operate.md +61 -61
  195. package/skills/impeccable/reference/optimize.md +257 -257
  196. package/skills/impeccable/reference/overdrive.md +127 -127
  197. package/skills/impeccable/reference/polish.md +105 -105
  198. package/skills/impeccable/reference/quieter.md +99 -99
  199. package/skills/impeccable/reference/region-map.md +26 -26
  200. package/skills/impeccable/reference/routing.md +24 -24
  201. package/skills/impeccable/reference/shape.md +59 -59
  202. package/skills/impeccable/reference/typeset.md +90 -90
  203. package/skills/impeccable/reference/visualize.md +47 -47
  204. package/skills/impeccable/scripts/VERSION +1 -1
  205. package/skills/impeccable/scripts/command-metadata.json +98 -98
  206. package/skills/impeccable/scripts/data/font-index-failures.json +120 -120
  207. package/skills/impeccable/scripts/engine-checksums.txt +9 -9
  208. package/skills/impeccable/scripts/impeccable +249 -249
  209. package/skills/impeccable/scripts/impeccable.cmd +278 -278
  210. package/skills/impeccable/scripts/live-browser-dom.js +320 -320
  211. package/skills/impeccable/scripts/live-browser-ignores.js +246 -246
  212. package/skills/impeccable/scripts/live-browser-session.js +183 -183
  213. package/skills/impeccable/scripts/live-browser.js +13862 -13862
  214. package/skills/impeccable/scripts/modern-screenshot.umd.js +14 -14
  215. package/skills/improve-animations/AUDIT.md +115 -115
  216. package/skills/improve-animations/LICENSE +21 -21
  217. package/skills/improve-animations/PLAN-TEMPLATE.md +73 -73
  218. package/skills/improve-animations/SKILL.md +110 -110
  219. package/skills/improve-animations/UPSTREAM.md +19 -19
  220. package/skills/pick-ui-library/LICENSE +21 -21
  221. package/skills/pick-ui-library/SKILL.md +85 -85
  222. package/skills/pick-ui-library/UPSTREAM.md +19 -19
  223. package/skills/review-animations/LICENSE +21 -21
  224. package/skills/review-animations/SKILL.md +120 -120
  225. package/skills/review-animations/STANDARDS.md +187 -187
  226. package/skills/review-animations/UPSTREAM.md +19 -19
  227. package/skills/test/SKILL.md +29 -29
  228. package/skills/test/references/test-method.md +60 -60
  229. package/skills/write-doc/SKILL.md +115 -115
  230. package/skills/write-doc/examples/result-report.md +53 -53
  231. package/skills/write-doc/examples/task-summary.md +45 -45
  232. package/skills/write-doc/references/terminology.md +147 -147
  233. package/specs/ask-host-protocol-v1.md +58 -0
  234. package/specs/design-demo.md +1102 -1102
  235. package/specs/frontend-immersive.md +28 -28
  236. package/specs/plugin-install-v2.md +123 -0
  237. package/specs/plugin-install.md +38 -0
  238. package/specs/web-modes/explore.md +31 -31
  239. package/specs/web-modes/risk.md +15 -15
  240. package/specs/web-modes/verify.md +16 -16
  241. package/vc-extras.mjs +46 -62
  242. package/plugins/essrj/context.ts +0 -47
  243. package/plugins/essrj/data.ts +0 -190
  244. package/plugins/essrj/index.ts +0 -139
  245. package/plugins/essrj/package.json +0 -12
  246. package/plugins/essrj/project-local-owner.ts +0 -106
  247. package/plugins/essrj/render.ts +0 -217
  248. package/plugins/essrj/types.ts +0 -40
  249. package/plugins.json +0 -38
package/README.md CHANGED
@@ -1,71 +1,128 @@
1
- # vc-extras
2
-
3
- `vc` 的可选增强。工作流、阶段审批和任务状态仍由 `vc` 管理。三个 Pi 包可各自注册,安装其中一个不会自动安装其余包或任何第三方插件。
4
-
5
- ## 交互安装
6
-
7
- 发布到 npm 后,在终端运行 `npx vc-extras`。当前未发布,可在本仓库根目录用 `npx --offline --yes --package . -- vc-extras` 体验同一个入口(`--offline` 只用于取得本地安装器;勾选第三方插件或 Config UI 后,安装步骤仍可能访问 npm)。也可直接运行 `node ./vc-extras.mjs`。
8
-
9
- 用 **↑/↓** 移动、**空格** 勾选,按 **Enter** 预览,再按一次 **Enter** 安装。默认不勾选任何项目,**Esc** 或 **Ctrl+C** 可在确认前取消。清单统一列出 8 个 Pi 插件(包括 ESSRJ 和 Config UI),另有可单独勾选的用户级 Skills。选插件需要 PATH 上有 `pi`,选 Config UI 还需要 `npm`。如果已有自定义状态栏,请先决定保留哪一套;使用 `vc` 时通常不需要重复选 Jev。
10
-
11
- - 自带插件复制到 `~/.agents/vc-extras-plugins/<插件名>/`,再由 Pi 注册到用户级配置,不引用 npx 缓存。相同版本内容可重新注册;遇到不同内容不会覆盖,需先注销旧路径并移走旧目录。用 `pi list` 核对实际注册路径。
12
- - 第三方插件由 `pi install npm:...` 安装到 Pi 管理的位置;只执行勾选的项。若中途失败,已完成的项目保留,未开始的项目不执行。
13
- - 勾选 Skills 会复制到 `~/.agents/skills/`,默认保留同名目录。希望覆盖时,用 `npx vc-extras install --overwrite` 再勾选 Skills;未发布时对应 `node ./vc-extras.mjs install --overwrite`。两种用户级位置都优先取 `HOME`,否则用系统用户主目录。
14
-
15
- ## 单独安装用户级技能
16
-
17
- 在本仓库根目录执行(Node.js 22.19+):
18
-
19
- ```powershell
20
- node ./vc-extras.mjs install-skills # 安装缺少的技能,同名目录保留
21
- node ./vc-extras.mjs install-skills --overwrite # 备份并覆盖同名技能目录
22
- ```
23
-
24
- 命令把清单中的 16 个技能连同各自的参考资料复制到 `~/.agents/skills/`(`~` 优先取 `HOME`,否则取系统用户主目录,与 `vc` 一致)。安装后不依赖当前 checkout。覆盖是**整目录替换,不是合并**:旧目录移到命令输出的 `~/.agents/vc-extras-skill-backups/<批次>/`,包括用户添加的文件。要恢复某个技能,先移走该同名的新目录,再把备份里的原目录移回 `~/.agents/skills/`。不会替换 `vc` 所有权记录中的技能,也不会碰其他技能目录、Pi 设置或项目文件。运行中的 Pi 需重启或 `/reload` 才会重新发现技能。
25
-
26
- ## 注册 Pi 包(按需)
27
-
28
- 在本仓库根目录执行,不必全部注册。插件需要 npm 和 Pi。
29
-
30
- ```powershell
31
- pi install .
32
- pi install ./plugins/essrj
33
- npm --prefix ./plugins/config-ui install --omit=dev --omit=peer
34
- pi install ./plugins/config-ui
35
- ```
36
-
37
- - 根包 `vc-extras`:通过 Pi 加载当前 checkout 里的技能和 `Tester` 角色,而不是复制用户级技能;只用用户级技能时不必注册根包。`test` 仍需要用支持包角色发现的 `@tintinweb/pi-subagents` 加载 `Tester`,并按测试环境准备 MCP 工具;`find-the-truth` 需要 `vc` 提供的 `Explorer` 和子代理工具。两份规范及 `web-modes` 提示词是按需读取的素材,不写入项目 `.emma/specs/`。`trace-rationale` 原资料不完整,未注册或分发。
38
- - `vibe-essrj`:Pi 状态栏,可选读取 `vc` 的工作流状态。不与另一套自定义 footer 同时启用。
39
- - `vibe-config-ui`:在 Pi 里使用 `/config`。已有同名注册时,先在 Pi 中核对来源,避免两个版本同时加载。保存会影响当前 Pi 用户配置,修改前先看预览。
40
-
41
- ### 升级、移除与旧安装
42
-
43
- - **升级**:更新当初注册的同一个 checkout;`pi update` 不会更新本地路径。若装了 Config UI,在该 checkout 重跑 `npm --prefix ./plugins/config-ui install --omit=dev --omit=peer`,然后重启 Pi 或运行 `/reload`。
44
- - **移除**:用 `pi list` 确认注册来源,再用 `pi remove <相同来源>` 注销对应的 Pi 包。它不会移除 `install-skills` 复制的用户级技能;要停用这些技能,可将对应目录移出 `~/.agents/skills/`。重启或重载 Pi 后生效。
45
- - **同名技能**:如果旧 Emma 的技能在 `~/.agents/skills/`,可以用 `install-skills --overwrite` 替换。该命令不改项目级技能或其他目录里的副本;如仍有冲突,查看 Pi 的 `name … collision` 提示,核对实际加载路径。
46
-
47
- 配置页离线模式 `/config --no-server` 会下载补丁。先在 Pi 里运行 `/config apply "<下载文件的完整路径>" --dry-run` 检查,再去掉 `--dry-run` 应用。重载或关闭会话后,旧在线页面不能继续保存。
48
-
49
- ## 查看插件安装计划
50
-
51
- ```powershell
52
- node ./vc-extras.mjs plan
53
- node ./vc-extras.mjs plan essrj config-ui pi-mcp-adapter
54
- ```
55
-
56
- `plan` 与交互菜单共用 `plugins.json`,只打印命令,不安装、不修改设置。手动执行本地插件的命令时,须从本仓库根目录运行;Config UI 要先安装依赖。手动选择要运行的命令。`pi-claude-code` 与 `pi-cc-extensions` 是不同的 npm 包,不自动迁移两者配置或注销旧包。MCP 服务、Blackhole 压缩策略以及第三方插件权限分别由对应上游配置。
57
-
58
- `pi-jev-auto-mode` 可以单独安装;如果已使用 `vc`,继续由 `vc` 保持原有默认安装和审查策略,不重复迁移或重写其配置。Jev 的审查不是 `vc` 内建阶段守卫的同义替代。
59
-
60
- ## 开发验证
61
-
62
- ```powershell
63
- npm install
64
- npm --prefix ./plugins/config-ui install --omit=dev --omit=peer
65
- npm test
66
- npm pack --dry-run
67
- npm pack ./plugins/essrj --dry-run
68
- npm pack ./plugins/config-ui --dry-run
69
- ```
70
-
71
- 技能各自保留其附带的 `LICENSE`、`NOTICE` 和参考资料。
1
+ # vc-extras
2
+
3
+ `vc` 的可选增强。工作流、阶段审批和任务状态仍由 `vc` 管理。三个 Pi 包可各自注册,安装其中一个不会自动安装其余包或任何第三方插件。
4
+
5
+ ## 交互安装
6
+
7
+ 从 npm 运行安装器:`npx vc-extras`。要使用当前检出的源码,可在本仓库根目录运行 `npx --offline --yes --package . -- vc-extras`(`--offline` 只用于取得本地安装器;勾选第三方插件或 Config UI 后,安装步骤仍可能访问 npm),也可直接运行 `node ./vc-extras.mjs`。
8
+
9
+ 先勾选 **Agent**,按 **Enter** 后只显示这些 Agent 支持的插件。同一插件可分别为多个 Agent 勾选。用 **↑/↓** 移动、**空格** 勾选,按 **Enter** 预览安装路径和配置变更,再按一次 **Enter** 安装。默认无勾选;确认前按 **Esc** 或 **Ctrl+C** 可取消。
10
+
11
+ - 自带插件按目标复制到 `~/.agents/vc-extras-plugins/<agent>/<插件名>/`。相同内容可重装,已有不同内容不会覆盖。已有 Claude Code 状态栏或同名 Codex MCP 服务时也会停止,不静默替换。
12
+ - 只有选了 Pi 插件才调用 `pi`。第三方 Pi 插件通过 `pi install npm:...` 安装,Config UI 还需 `npm`。失败后会列出已完成和未执行的目标。
13
+ - 用户级 Skills 用下方的独立命令安装。`~` 优先取 `HOME`,否则使用系统用户主目录。
14
+
15
+ ## 单独安装用户级技能
16
+
17
+ 在本仓库根目录执行(Node.js 22.19+):
18
+
19
+ ```powershell
20
+ node ./vc-extras.mjs install-skills # 安装缺少的技能,同名目录保留
21
+ node ./vc-extras.mjs install-skills --overwrite # 备份并覆盖同名技能目录
22
+ ```
23
+
24
+ 命令把清单中的 16 个技能连同各自的参考资料复制到 `~/.agents/skills/`(`~` 优先取 `HOME`,否则取系统用户主目录,与 `vc` 一致)。安装后不依赖当前 checkout。覆盖是**整目录替换,不是合并**:旧目录移到命令输出的 `~/.agents/vc-extras-skill-backups/<批次>/`,包括用户添加的文件。要恢复某个技能,先移走该同名的新目录,再把备份里的原目录移回 `~/.agents/skills/`。不会替换 `vc` 所有权记录中的技能,也不会碰其他技能目录、Pi 设置或项目文件。运行中的 Pi 需重启或 `/reload` 才会重新发现技能。
25
+
26
+ ## 注册 Pi 包(按需)
27
+
28
+ 在本仓库根目录执行,不必全部注册。插件需要 npm 和 Pi。
29
+
30
+ ```powershell
31
+ pi install .
32
+ pi install ./plugins/vc-footer
33
+ npm --prefix ./plugins/config-ui install --omit=dev --omit=peer
34
+ pi install ./plugins/config-ui
35
+ ```
36
+
37
+ - 根包 `vc-extras`:通过 Pi 加载当前 checkout 里的技能和 `Tester` 角色,而不是复制用户级技能;只用用户级技能时不必注册根包。`test` 仍需要用支持包角色发现的 `@tintinweb/pi-subagents` 加载 `Tester`,并按测试环境准备 MCP 工具;`find-the-truth` 需要 `vc` 提供的 `Explorer` 和子代理工具。两份规范及 `web-modes` 提示词是按需读取的素材,不写入项目 `.emma/specs/`。`trace-rationale` 原资料不完整,未注册或分发。
38
+ - `vc-footer`:共享状态数据和默认布局,Pi、Claude Code 和 Codex 各有独立入口与渲染器。
39
+ - `vibe-config-ui`:在 Pi 里使用 `/config`。已有同名注册时,先在 Pi 中核对来源,避免两个版本同时加载。保存会影响当前 Pi 用户配置,修改前先看预览。
40
+
41
+ ### vc-ask 和网页检索
42
+
43
+ 在 extras 安装器选 **Pi**,再勾选 `vc-ask` 或 `pi-web-access`。`pi-web-access` 继续从上游 npm 安装;无需改用 Smart Search。
44
+
45
+ `vc-ask` 保留 `ask` 的表单和文档模式,并沿用 tty7 的 `emma:ask-user:*` 双向协议。配合包含 `vc-ask:service.v1` 接入的 Emma,插件负责注册 `ask`,Emma 的阶段工具复用它的界面;未安装插件时,Emma 继续使用内置问卷。旧版 Emma 会自行注册 `ask`,请先更新 Emma 再一起使用。
46
+
47
+ Pi 普通表单默认没有截止时间,会等待用户回答或取消。可在 Pi 用户配置目录(默认 `~/.pi/agent`)的 `vc-ask.json` 中分别配置超时和超时自动选择:
48
+
49
+ ```json
50
+ {
51
+ "timeout": {
52
+ "enabled": true,
53
+ "seconds": 120,
54
+ "autoSelect": false,
55
+ "allowed": [{ "question": "Preferred report format?", "option": "Markdown" }]
56
+ }
57
+ }
58
+ ```
59
+
60
+ - `enabled` 省略或为 `false`:不设超时。为 `true` 时,`seconds` 必须为 1–86400 秒的整数。
61
+ - `autoSelect` 省略或为 `false`:到期告诉 Agent「用户未选择」,不提交预选项。显式设为 `true` 后,只有每题都是简单单选、且题文与唯一推荐项都匹配 `allowed` 时,才会自动选择。请只将可逆的日常选择加入白名单;自动答案会标注为未经用户确认。
62
+
63
+ 这套配置同样适用于宿主认领的 Pi 普通表单。宿主收到 `recommended` 用于预选,并通过关闭事件获得实际超时结果。旧 tty7 桥接需要更新才能使用这些信息。文档、阶段审批和 RPC 不启用此策略;取消或断开不会触发自动选择。
64
+
65
+ 在 Pi 里可以先执行 `/vc-ask unattended 120`,再发起任务。它只为当前会话的后续普通问卷临时启用 120 秒超时和白名单自动选择;到期时若没有匹配的白名单条目,就报告用户未选择。白名单仍从 `vc-ask.json` 读取,即使文件里 `enabled` 为 `false`,也可为这个命令提供 `allowed`。
66
+
67
+ - `/vc-ask status`:查看当前超时、自动选择、白名单条数和配置来源。
68
+ - `/vc-ask reset`:清除会话覆盖,恢复文件配置。切换会话、重载或退出也会清除覆盖。
69
+
70
+ 命令不改写配置,也不改变已打开的问卷。
71
+
72
+ ### 把 Claude Code 的问卷交给 tty7
73
+
74
+ ```sh
75
+ node ./vc-extras.mjs plan --agent=claude-code vc-ask:claude-code
76
+ node ./vc-extras.mjs install --agent=claude-code --plugin=vc-ask:claude-code
77
+ ```
78
+
79
+ 只注册 `AskUserQuestion` 的 `PreToolUse` hook,使用 Claude Code 支持的 `command` + `args` 直接启动,不依赖 Git Bash 或 PowerShell 的引号规则。若配置里已有 tty7 自带的 `agent-hook claude ask-block`,安装器保留它并报告「新协议未启用」。
80
+
81
+ 要迁移到新协议,先确认宿主已支持并监听 `VC_ASK_SOCKET`,备份 Claude Code 设置,只移除 `hooks.PreToolUse` 里匹配 `AskUserQuestion` 的旧 `ask-block` 命令(或旧版 `vc-ask` shell 命令),保留其他 hook。再执行安装并重启 Claude Code。
82
+
83
+ extras 的 hook 通过 [vc-ask/v1](specs/ask-host-protocol-v1.md) 向 `VC_ASK_SOCKET` 指定的宿主投递普通问卷。没有配置端点、连接失败或无人认领时,Claude Code 继续显示原生问卷。宿主认领后等待用户提交;取消、断线和超时均不视为同意。此 hook 不接管权限或计划审批,也不自动回答。
84
+
85
+ Pi 的 `vc-ask` 先尝试 socket;未认领时才发出旧 Pi 事件,仍无人认领才显示终端问卷。宿主应收到认领确认后再展示卡片。Codex 仍使用原生问卷;包内的 App Server 适配器可转发阻塞及非阻塞问卷,但须由宿主调用,extras 不注册 Codex 安装目标。新版 socket 协议需要宿主实现监听;现有 tty7 的 Pi 与 Claude hook 不会自动切换到该协议。
86
+
87
+ ### vc-footer 在三个客户端的用法
88
+
89
+ - **Pi**:extras 调用 `pi install` 注册扩展。旧 `essrj` 如果已经注册,请先用 `pi list` 找到旧来源并用 `pi remove` 注销,以免两个状态栏同时加载。
90
+ - **Claude Code**:extras 在 `~/.claude/settings.json` 设置 `statusLine.command`。命令从 stdin 读取状态 JSON,无需手动传参。
91
+ - **Codex**:extras 在 `~/.codex/config.toml` 注册 MCP provider。需要支持实验状态栏的 Codex(如 v0.171.0):在 `/experimental` 启用 **Custom status line**,重启后在 `/statusline` 选择 `vc-footer` provider。Codex 快照不提供最近请求的缓存命中率或输出耗时,这两项显示 `-`。
92
+
93
+ 设置了 `CLAUDE_CONFIG_DIR` 或 `CODEX_HOME` 时,安装预览和执行会使用对应目录中的 `settings.json` 或 `config.toml`。变量未设置或为空时,使用上面列出的默认位置。
94
+
95
+ Claude Code 优先从 `context_window.current_usage` 计算最近一次缓存命中率,缺少该字段时读取 `transcript_path`。Token 速度仅在最新回复提供明确的 `durationMs` 时计算;只有 transcript 时间戳时显示 `-to/s`。
96
+
97
+ ### 升级、移除与旧安装
98
+
99
+ - **升级**:更新当初注册的同一个 checkout;`pi update` 不会更新本地路径。若装了 Config UI,在该 checkout 重跑 `npm --prefix ./plugins/config-ui install --omit=dev --omit=peer`,然后重启 Pi 或运行 `/reload`。
100
+ - **移除**:用 `pi list` 确认注册来源,再用 `pi remove <相同来源>` 注销对应的 Pi 包。它不会移除 `install-skills` 复制的用户级技能;要停用这些技能,可将对应目录移出 `~/.agents/skills/`。重启或重载 Pi 后生效。
101
+ - **同名技能**:如果旧 Emma 的技能在 `~/.agents/skills/`,可以用 `install-skills --overwrite` 替换。该命令不改项目级技能或其他目录里的副本;如仍有冲突,查看 Pi 的 `name … collision` 提示,核对实际加载路径。
102
+
103
+ 配置页离线模式 `/config --no-server` 会下载补丁。先在 Pi 里运行 `/config apply "<下载文件的完整路径>" --dry-run` 检查,再去掉 `--dry-run` 应用。重载或关闭会话后,旧在线页面不能继续保存。
104
+
105
+ ## 查看插件安装计划
106
+
107
+ ```powershell
108
+ node ./vc-extras.mjs plan
109
+ node ./vc-extras.mjs plan --agent=pi,codex vc-footer:pi vc-footer:codex
110
+ node ./vc-extras.mjs install --agent=claude-code,codex --plugin=vc-footer:claude-code,vc-footer:codex
111
+ ```
112
+
113
+ `plan` 只显示安装计划,可用 `--json` 输出结构化结果。非交互安装必须同时指定 `--agent=` 和 `--plugin=`;安装目标写作 `插件:Agent`。菜单与计划均读取 [安装协议](specs/plugin-install.md) 定义的 `plugins/*/vc-extras.plugin.json`。`pi-claude-code` 是 Pi 插件,与 Claude Code 安装目标无关。
114
+
115
+ `pi-jev-auto-mode` 可以单独安装;如果已使用 `vc`,继续由 `vc` 保持原有默认安装和审查策略,不重复迁移或重写其配置。Jev 的审查不是 `vc` 内建阶段守卫的同义替代。
116
+
117
+ ## 开发验证
118
+
119
+ ```powershell
120
+ npm install
121
+ npm --prefix ./plugins/config-ui install --omit=dev --omit=peer
122
+ npm test
123
+ npm pack --dry-run
124
+ npm pack ./plugins/vc-footer --dry-run
125
+ npm pack ./plugins/config-ui --dry-run
126
+ ```
127
+
128
+ 技能各自保留其附带的 `LICENSE`、`NOTICE` 和参考资料。
@@ -0,0 +1,159 @@
1
+ import * as fs from 'node:fs';
2
+ import { createHash } from 'node:crypto';
3
+ import { dirname, join, relative, resolve } from 'node:path';
4
+ import { isDeepStrictEqual } from 'node:util';
5
+ import { parse } from 'smol-toml';
6
+ import { ownedPath, localFiles } from './plugin-registry.mjs';
7
+
8
+ const stat = p => fs.lstatSync(p, { throwIfNoEntry: false });
9
+ function directory(path) {
10
+ if (!stat(path)) fs.mkdirSync(path, { mode: 0o700 });
11
+ if (!stat(path)?.isDirectory()) throw new Error(`不是普通目录:${path}`);
12
+ return path;
13
+ }
14
+ export function destination(plan, home) {
15
+ return join(home, '.agents', 'vc-extras-plugins', plan.agent, plan.id);
16
+ }
17
+ export function configPath(plan, home, env = process.env) {
18
+ if (plan.agent === 'claude-code') return resolve(env.CLAUDE_CONFIG_DIR || join(home, '.claude'), 'settings.json');
19
+ if (plan.agent === 'codex') return resolve(env.CODEX_HOME || join(home, '.codex'), 'config.toml');
20
+ return null;
21
+ }
22
+ function payload(root, entries) {
23
+ const hash = createHash('sha256'), files = [];
24
+ function visit(path) {
25
+ const info = stat(path);
26
+ if (info?.isDirectory()) {
27
+ for (const name of fs.readdirSync(path).sort()) visit(join(path, name));
28
+ } else if (info?.isFile()) {
29
+ const name = relative(root, path), data = fs.readFileSync(path);
30
+ hash.update(JSON.stringify([name, data.length])).update(data);
31
+ files.push({ name, data, mode: info.mode });
32
+ } else throw new Error(`不是普通运行文件:${path}`);
33
+ }
34
+ for (const name of entries) visit(ownedPath(root, name));
35
+ return { files, digest: hash.digest('hex') };
36
+ }
37
+ function prepare(plan, home, execute) {
38
+ const entries = localFiles(plan.root, plan.agent, plan);
39
+ const source = payload(plan.root, entries);
40
+ const parent = directory(join(directory(join(directory(join(home, '.agents')), 'vc-extras-plugins')), plan.agent));
41
+ const target = destination(plan, home);
42
+ if (stat(target)) {
43
+ if (!stat(target).isDirectory() || payload(target, entries).digest !== source.digest) throw new Error(`已有不同内容,未覆盖:${target}`);
44
+ return target;
45
+ }
46
+ const stage = fs.mkdtempSync(join(parent, '.stage-'));
47
+ try {
48
+ for (const { name, data, mode } of source.files) {
49
+ const file = join(stage, name);
50
+ fs.mkdirSync(dirname(file), { recursive: true });
51
+ fs.writeFileSync(file, data, { mode, flag: 'wx' });
52
+ }
53
+ if (plan.dependencies) execute('npm', ['install', '--omit=dev', '--omit=peer', '--ignore-scripts'], stage);
54
+ if (stat(target)) throw new Error(`安装目录已存在:${target}`);
55
+ fs.renameSync(stage, target);
56
+ return target;
57
+ } finally { fs.rmSync(stage, { recursive: true, force: true }); }
58
+ }
59
+ function shellQuote(value) {
60
+ return `'${value.replaceAll("'", "'\\''")}'`;
61
+ }
62
+ function addCodexServer(raw, parsed, id, server) {
63
+ const { command, args } = server;
64
+ const appended = `${raw}${raw ? '\n\n' : ''}[mcp_servers.${id}]\ncommand = ${JSON.stringify(command)}\nargs = ${JSON.stringify(args)}\n`;
65
+ try {
66
+ parse(appended);
67
+ return appended;
68
+ } catch (appendError) {
69
+ // Inline TOML tables are closed to later declarations. Insert inside the existing table.
70
+ const before = parsed.mcp_servers;
71
+ const added = parse(appended.slice(raw.length)).mcp_servers[id];
72
+ const expected = { ...parsed, mcp_servers: { ...before, [id]: added } };
73
+ const member = ` ${id} = { command = ${JSON.stringify(command)}, args = ${JSON.stringify(args)} }`;
74
+ for (const match of raw.matchAll(/^[\t ]*(?:mcp_servers|"mcp_servers"|'mcp_servers')[\t ]*=[\t ]*\{/gm)) {
75
+ const position = match.index + match[0].length;
76
+ const candidate = raw.slice(0, position) + member + (Object.keys(before).length ? ',' : ' ') + raw.slice(position);
77
+ // This text could also occur inside a multiline string. Verify the entire document.
78
+ try {
79
+ const updated = parse(candidate);
80
+ if (isDeepStrictEqual({ ...updated, mcp_servers: { ...updated.mcp_servers } }, expected)) return candidate;
81
+ } catch {
82
+ // Try the next match if this one is not a TOML assignment.
83
+ }
84
+ }
85
+ throw appendError;
86
+ }
87
+ }
88
+ function configChange(plan, home, node, env) {
89
+ const file = configPath(plan, home, env), parent = dirname(file);
90
+ if ((stat(parent) && !stat(parent).isDirectory()) || (stat(file) && !stat(file).isFile())) throw new Error(`配置路径不安全:${file}`);
91
+ const info = stat(file), old = info ? fs.readFileSync(file, 'utf8') : null;
92
+ const entry = join(destination(plan, home), plan.entry);
93
+ let next;
94
+ if (plan.agent === 'claude-code') {
95
+ const settings = old === null ? {} : JSON.parse(old);
96
+ if (!settings || typeof settings !== 'object' || Array.isArray(settings)) throw new Error(`无效配置:${file}`);
97
+ // Hook entries use exec form so paths never depend on Bash/PowerShell quoting.
98
+ const command = node;
99
+ const args = [entry];
100
+ const shellPath = path => process.platform === 'win32' ? path.replaceAll('\\', '/') : path;
101
+ const shellCommand = `${shellQuote(shellPath(node))} ${shellQuote(shellPath(entry))}`;
102
+ if (plan.kind === 'claude-ask-hook') {
103
+ const hooks = Object.hasOwn(settings, 'hooks') ? settings.hooks : {};
104
+ if (!hooks || typeof hooks !== 'object' || Array.isArray(hooks)) throw new Error(`无效 Claude Code hooks:${file}`);
105
+ const pre = Object.hasOwn(hooks, 'PreToolUse') ? hooks.PreToolUse : [];
106
+ if (!Array.isArray(pre)) throw new Error(`无效 Claude Code PreToolUse:${file}`);
107
+ const hasHook = predicate => pre.some(group => group?.matcher === 'AskUserQuestion' && Array.isArray(group.hooks) &&
108
+ group.hooks.some(hook => hook?.type === 'command' && typeof hook.command === 'string' && predicate(hook)));
109
+ if (hasHook(hook => Array.isArray(hook.args)
110
+ ? isDeepStrictEqual(hook.args, ['agent-hook', 'claude', 'ask-block'])
111
+ : /\bagent-hook\s+claude\s+ask-block\s*$/.test(hook.command.trim()))) return { legacyHook: true };
112
+ if (hasHook(hook => hook.command === command && isDeepStrictEqual(hook.args, args))) return () => {};
113
+ if (hasHook(hook => hook.args === undefined && hook.command === shellCommand)) {
114
+ throw new Error(`已注册旧版 vc-ask shell hook;请移除该条 hook 后重新安装:${file}`);
115
+ }
116
+ next = JSON.stringify({ ...settings, hooks: { ...hooks, PreToolUse: [...pre, {
117
+ matcher: 'AskUserQuestion', hooks: [{ type: 'command', command, args, timeout: 610 }],
118
+ }] } }, null, 2) + '\n';
119
+ } else {
120
+ if (Object.hasOwn(settings, 'statusLine')) {
121
+ if (settings.statusLine?.type === 'command' && settings.statusLine.command === shellCommand) return () => {};
122
+ throw new Error(`Claude Code 已存在 statusLine,未覆盖:${file}`);
123
+ }
124
+ next = JSON.stringify({ ...settings, statusLine: { type: 'command', command: shellCommand } }, null, 2) + '\n';
125
+ }
126
+ } else {
127
+ const parsed = parse(old ?? ''), args = [entry];
128
+ if (Object.hasOwn(parsed, 'mcp_servers') && (typeof parsed.mcp_servers !== 'object' || Array.isArray(parsed.mcp_servers))) throw new Error(`无效 MCP 配置:${file}`);
129
+ if (Object.hasOwn(parsed.mcp_servers ?? {}, plan.id)) {
130
+ const prev = parsed.mcp_servers[plan.id];
131
+ if (prev?.command === node && JSON.stringify(prev.args) === JSON.stringify(args)) return () => {};
132
+ throw new Error(`Codex 已存在同名 MCP 服务,未覆盖:${file}`);
133
+ }
134
+ next = addCodexServer(old ?? '', parsed, plan.id, { command: node, args });
135
+ }
136
+ return () => {
137
+ if (!stat(parent)) fs.mkdirSync(parent, { recursive: true, mode: 0o700 });
138
+ directory(parent);
139
+ const stage = fs.mkdtempSync(join(parent, '.vc-extras-'));
140
+ try {
141
+ const temp = join(stage, 'config');
142
+ fs.writeFileSync(temp, next, { flag: 'wx', mode: info ? info.mode & 0o777 : 0o600 });
143
+ const current = stat(file);
144
+ if ((current && !current.isFile()) || (current ? fs.readFileSync(file, 'utf8') : null) !== old) throw new Error(`配置已变更,请重新安装:${file}`);
145
+ fs.renameSync(temp, file);
146
+ return { skipped: false };
147
+ } finally { fs.rmSync(stage, { recursive: true, force: true }); }
148
+ };
149
+ }
150
+ export function installTarget(plan, { home, execute, node = process.execPath, env = process.env }) {
151
+ if (plan.kind === 'pi-package') {
152
+ execute('pi', ['install', plan.source ?? prepare(plan, home, execute)], home);
153
+ return { skipped: false };
154
+ }
155
+ const save = configChange(plan, home, node, env);
156
+ if (save.legacyHook) return save;
157
+ prepare(plan, home, execute);
158
+ return save();
159
+ }
package/agents/tester.md CHANGED
@@ -1,23 +1,23 @@
1
- ---
2
- name: Tester
3
- description: End-to-end testing sub-agent. Executes end-to-end tests (functional and experience-related) for specified features/fixes and outputs a test report containing test items, conclusions, and evidence.
4
- tools: read, grep, find, ls, bash, write, edit, ext:pi-mcp-adapter/mcp
5
- thinking: medium
6
- run_in_background: true
7
- prompt_mode: replace
8
- inherit_context: false
9
- isolation: off
10
- extensions: [pi-mcp-adapter, pi-jev-auto-mode]
11
- skills: false
12
- ---
13
- You are the E2E testing sub-agent: verify the specified feature/fix end-to-end and deliver a test report with conclusions and evidence.
14
-
15
- ## Hard constraints
16
-
17
- - Two item regimes: functional items get 「Pass / Fail / Blocked」; experience items only record observations, suggestions, and issues — never a pass/fail verdict.
18
- - Every result must carry evidence (screenshot, actual output, or log) — a screenshot path alone is not evidence.
19
- - No guessing, no fabrication: mark items that cannot be verified as 「Blocked」 and state what is missing.
20
- - This verification only: do not solidify regression cases, do not execute Git write operations, do not modify product code or long-lived test cases; temp scripts, logs, and screenshots go to the task artifact directory.
21
- - Use the test's own process, terminal, browser, or device — never the environment the user is operating; background does not mean non-intrusive. Tests needing mouse, keyboard, or window focus run in an isolated test environment.
22
- - Real payments, outbound sending, irreversible data operations: obtain explicit authorization first.
23
- - Testing method and tools are your call; project-level docs override when they specify.
1
+ ---
2
+ name: Tester
3
+ description: End-to-end testing sub-agent. Executes end-to-end tests (functional and experience-related) for specified features/fixes and outputs a test report containing test items, conclusions, and evidence.
4
+ tools: read, grep, find, ls, bash, write, edit, ext:pi-mcp-adapter/mcp
5
+ thinking: medium
6
+ run_in_background: true
7
+ prompt_mode: replace
8
+ inherit_context: false
9
+ isolation: off
10
+ extensions: [pi-mcp-adapter, pi-jev-auto-mode]
11
+ skills: false
12
+ ---
13
+ You are the E2E testing sub-agent: verify the specified feature/fix end-to-end and deliver a test report with conclusions and evidence.
14
+
15
+ ## Hard constraints
16
+
17
+ - Two item regimes: functional items get 「Pass / Fail / Blocked」; experience items only record observations, suggestions, and issues — never a pass/fail verdict.
18
+ - Every result must carry evidence (screenshot, actual output, or log) — a screenshot path alone is not evidence.
19
+ - No guessing, no fabrication: mark items that cannot be verified as 「Blocked」 and state what is missing.
20
+ - This verification only: do not solidify regression cases, do not execute Git write operations, do not modify product code or long-lived test cases; temp scripts, logs, and screenshots go to the task artifact directory.
21
+ - Use the test's own process, terminal, browser, or device — never the environment the user is operating; background does not mean non-intrusive. Tests needing mouse, keyboard, or window focus run in an isolated test environment.
22
+ - Real payments, outbound sending, irreversible data operations: obtain explicit authorization first.
23
+ - Testing method and tools are your call; project-level docs override when they specify.
@@ -1,134 +1,66 @@
1
- import * as fs from 'node:fs';
1
+ import { realpathSync } from 'node:fs';
2
2
  import { spawnSync } from 'node:child_process';
3
- import { createHash } from 'node:crypto';
4
3
  import { homedir } from 'node:os';
5
- import { isAbsolute, join } from 'node:path';
6
- import { fileURLToPath } from 'node:url';
4
+ import { isAbsolute } from 'node:path';
7
5
  import { installSkills } from './install-skills.mjs';
6
+ import { AGENTS, discoverPlugins, targetChoices, createPlan } from './plugin-registry.mjs';
7
+ import { installTarget, destination, configPath } from './agent-install.mjs';
8
8
 
9
- const catalogue = JSON.parse(fs.readFileSync(new URL('./plugins.json', import.meta.url), 'utf8'));
10
- export function planPlugins(ids) {
11
- return (ids.length ? [...new Set(ids)] : Object.keys(catalogue)).map(id => {
12
- if (!Object.hasOwn(catalogue, id)) throw new Error(`Unknown plugin: ${id}`);
13
- const { source, note } = catalogue[id];
14
- return { id, source, note };
15
- });
16
- }
17
-
18
- const skills = 'skills';
19
- export const choices = [
20
- { id: skills, label: '用户级 Skills(16 个;保留已有同名技能)' },
21
- ...Object.entries(catalogue).map(([id, { label = id }]) => ({ id, label })),
22
- ];
9
+ export { AGENTS, discoverPlugins, targetChoices };
10
+ export const defaultHome = () => process.env.HOME || homedir();
23
11
 
24
12
  export function installerCommand(name, args, platform = process.platform, env = process.env) {
25
13
  if (platform !== 'win32') return { file: name, args };
26
- // Pi and npm may only expose .cmd shims. Deliberately reject cmd metacharacters,
27
- // rather than interpolating an arbitrary directory name into a shell command.
28
- if (![name, ...args].every(arg => !/[\x00-\x1f"%!?&|<>^()]/.test(arg))) {
29
- throw new Error('无法安全地向 Windows 命令包装器传递该路径或参数');
30
- }
14
+ if (![name, ...args].every(arg => !/[\x00-\x1f"%!?&|<>^()]/.test(arg))) throw new Error('无法安全地向 Windows 命令包装器传递该路径或参数');
31
15
  const command = `"${name}.cmd ${args.map(arg => `"${arg}"`).join(' ')}"`;
32
16
  return { file: env.ComSpec || 'cmd.exe', args: ['/d', '/s', '/v:off', '/c', command], windowsVerbatimArguments: true };
33
17
  }
34
-
35
18
  function run(name, args, cwd) {
36
- const command = installerCommand(name, args);
37
- const result = spawnSync(command.file, command.args, { cwd, stdio: 'inherit', windowsVerbatimArguments: command.windowsVerbatimArguments });
19
+ const cmd = installerCommand(name, args);
20
+ const result = spawnSync(cmd.file, cmd.args, { cwd, stdio: 'inherit', windowsVerbatimArguments: cmd.windowsVerbatimArguments });
38
21
  if (result.error) throw result.error;
39
- if (result.status !== 0) throw new Error(`${name} 执行失败(${result.signal ?? `退出码 ${result.status}`})`);
22
+ if (result.status !== 0) throw new Error(`${name} 执行失败(${result.signal ?? result.status})`);
40
23
  }
41
24
 
42
- const stat = path => fs.lstatSync(path, { throwIfNoEntry: false });
43
- function ensureDirectory(path) {
44
- try { fs.mkdirSync(path, { mode: 0o700 }); }
45
- catch (err) { if (err.code !== 'EEXIST') throw err; }
46
- if (!stat(path)?.isDirectory()) throw new Error(`不是普通目录:${path}`);
47
- return path;
25
+ export function planPlugins(ids = [], agents = AGENTS, plugins = discoverPlugins()) {
26
+ const available = targetChoices(agents, plugins);
27
+ const selected = ids.length ? ids : available.map(p => p.id);
28
+ for (const key of selected) if (!available.some(p => p.id === key)) throw new Error(`未知或未选 Agent 的安装目标:${key}`);
29
+ return createPlan(selected, plugins);
48
30
  }
49
-
50
- function readPayload(root, entries) {
51
- const hash = createHash('sha256');
52
- const files = [];
53
- function visit(relative) {
54
- const path = join(root, relative);
55
- const info = stat(path);
56
- if (info?.isDirectory()) {
57
- for (const entry of fs.readdirSync(path).sort()) visit(`${relative}/${entry}`);
58
- } else if (info?.isFile()) {
59
- const bytes = fs.readFileSync(path);
60
- hash.update(JSON.stringify([relative, bytes.length])).update(bytes);
61
- files.push({ relative, bytes, mode: info.mode });
62
- } else throw new Error(`插件文件不存在或不是普通文件:${path}`);
63
- }
64
- for (const entry of entries) visit(entry);
65
- return { files, digest: hash.digest('hex') };
31
+ export function describeTarget(item, home = defaultHome(), env = process.env) {
32
+ const subject = `${item.id} → ${item.agent}`;
33
+ const location = item.source ?? destination(item, home);
34
+ const deps = item.dependencies ? ';安装 npm 依赖' : '';
35
+ if (item.agent === 'pi') return `${subject}:pi install ${location}${deps}(由 Pi 更新用户配置)`;
36
+ const field = item.kind === 'claude-ask-hook' ? ' 的 AskUserQuestion hook(已有 tty7 ask-block 时保留旧 hook,新协议不启用)' : item.agent === 'codex' ? ' 的 MCP 注册' : ' 的 statusLine';
37
+ return `${subject}:复制到 ${location};更新 ${configPath(item, home, env)}${field}`;
66
38
  }
67
39
 
68
- function prepareLocal({ id, source: location, dependencies }, { home, execute }) {
69
- const source = fileURLToPath(new URL(`${location}/`, import.meta.url));
70
- const manifest = JSON.parse(fs.readFileSync(join(source, 'package.json'), 'utf8'));
71
- // Use exactly what the standalone package ships, never a checkout's node_modules.
72
- const entries = ['package.json', ...manifest.files.map(entry => entry.replace(/\/$/, ''))];
73
- if (entries.some(entry => !/^[a-z0-9][a-z0-9._-]*$/i.test(entry))) throw new Error(`无效的插件文件声明:${id}`);
74
- const payload = readPayload(source, entries);
75
- const root = ensureDirectory(join(ensureDirectory(join(home, '.agents')), 'vc-extras-plugins'));
76
- const target = join(root, id);
77
- const piArgs = ['install', target];
78
- installerCommand('pi', piArgs); // Validate before copying the payload on Windows.
79
- if (stat(target)) {
80
- if (!stat(target)?.isDirectory() || readPayload(target, entries).digest !== payload.digest) {
81
- throw new Error(`已有不同内容的插件目录,未覆盖:${target}。升级时请先用 pi remove 注销旧路径并移走旧目录,再重装。`);
82
- }
83
- } else {
84
- const stage = fs.mkdtempSync(join(root, '.stage-'));
85
- try {
86
- for (const { relative, bytes, mode } of payload.files) {
87
- const path = join(stage, relative);
88
- fs.mkdirSync(join(path, '..'), { recursive: true });
89
- fs.writeFileSync(path, bytes, { flag: 'wx', mode });
90
- }
91
- if (dependencies) {
92
- execute('npm', ['install', '--omit=dev', '--omit=peer', '--ignore-scripts'], stage);
93
- }
94
- if (stat(target)) throw new Error(`插件目录已被其他操作创建,未覆盖:${target}`);
95
- fs.renameSync(stage, target);
96
- } finally {
97
- fs.rmSync(stage, { recursive: true, force: true });
98
- }
99
- }
100
- return target;
101
- }
102
-
103
- export function installSelected(ids, {
104
- home = process.env.HOME || homedir(), execute = run, overwrite = false, output = console.log,
105
- } = {}) {
40
+ export function installPlan(plan, { home = defaultHome(), execute = run, output = console.log, env = process.env } = {}) {
106
41
  if (!isAbsolute(home)) throw new Error('用户主目录必须是绝对路径');
107
- home = fs.realpathSync(home);
108
- const valid = new Set(choices.map(({ id }) => id));
109
- const selection = [...new Set(ids)];
110
- for (const id of selection) if (!valid.has(id)) throw new Error(`未知安装项:${id}`);
111
- if (selection.includes('essrj') && selection.includes('pi-claude-code')) {
112
- throw new Error('请分开安装 ESSRJ 和 pi-claude-code,并确保只启用一个自定义状态栏。');
113
- }
114
- if (selection.some(id => id !== skills)) execute('pi', ['--version'], home);
42
+ home = realpathSync(home);
115
43
  const done = [];
116
- for (const id of selection) {
44
+ for (const [i, item] of plan.entries()) {
117
45
  try {
118
- if (id === skills) {
119
- const result = installSkills({ home, overwrite });
120
- output(`用户级技能 → ${result.target}(新增 ${result.installed.length}、覆盖 ${result.replaced.length}、跳过 ${result.skipped.length})`);
121
- if (result.backup) output(`原目录备份:${result.backup}`);
122
- } else {
123
- const plugin = { id, ...catalogue[id] };
124
- const source = plugin.source.startsWith('./') ? prepareLocal(plugin, { home, execute }) : plugin.source;
125
- execute('pi', ['install', source], home);
126
- output(`已安装 ${id} → ${source}`);
46
+ if (item.agent === 'pi') installerCommand('pi', ['install', item.source ?? destination(item, home)]);
47
+ const installed = installTarget(item, { home, execute, env });
48
+ if (installed?.legacyHook) {
49
+ output(`已保留 tty7 原生 ask-block:${item.key}(未安装新 hook,新协议未启用)`);
50
+ continue;
127
51
  }
128
- done.push(id);
129
- } catch (err) {
130
- throw new Error(`安装 ${id} 失败:${err.message}${done.length ? `\n已完成:${done.join(', ')}` : ''}。后续项目未执行。`, { cause: err });
52
+ } catch (error) {
53
+ throw new Error(`安装 ${item.key} 失败:${error.message}\n已完成:${done.join(', ') || '无'}\n未执行:${plan.slice(i + 1).map(p => p.key).join(', ') || '无'}`, { cause: error });
131
54
  }
55
+ done.push(item.key);
56
+ output(`已安装 ${item.key}`);
57
+ if (item.agent === 'codex') output('待启用:在 Codex /experimental 启用 Custom status line,重启并在 /statusline 中选择 vc-footer provider。');
132
58
  }
133
59
  return done;
134
60
  }
61
+ export function installSelected(keys, options = {}) {
62
+ const plan = planPlugins(keys.filter(key => key !== 'skills'));
63
+ const done = [];
64
+ if (keys.includes('skills')) { installSkills({ home: options.home, overwrite: options.overwrite }); done.push('skills'); }
65
+ return keys.some(key => key !== 'skills') ? [...done, ...installPlan(plan, options)] : done;
66
+ }